import Vue from 'vue'
import vuex from 'vuex'
Vue.use(vuex)
//获取store:this.$store.state.xxx
export default new vuex.Store({
    state:{
        guideIndex: 0,
        guideEndModule: false,
        guideModule: false,
        mapList: [],
        wayPointMsg: "",
        stationList:[],//站点列表
        stationName: "",//站点名称
        showWhiteMask:false,//透明遮罩
        showBlackMask: false,//半透明
        robotPosition: '',//机器人坐标
        waypointsModule: false,//站点列表模态框
        showAddStation:false,//添加站点表单
        showWaypointDetail: false,//站点详情模态框
        trajectoryList: [],//轨迹列表
        trajectoryModule: false,//轨迹模态框
        showTrajectory: false,//轨迹详情模态框
        trackDetail: '',//轨迹详情
        delTrackName: '',//删除轨迹的名称
        deleteTrack: false,//轨迹删除模态框
        showAddTrack: false,//添加轨迹表单
        uploadMap: false,//上传地图
        downloadMap: false,//下载地图
        scale: 1,//缩放比例
        zoomDisabled: 2,//0：max  1:min  2:null
        rosMode: "",//ros状态，建图中还是导航中
        navControlStatus: null,//导航状态
        mappingFlag: false,
        chargeStatus: null,//充电状态
        showBattery: false,
        battery: 100,//电量
        authorization: false,//授权模态框
        authorizationPassword: '6022',
        developAuthorization: "343",
        role: "",
        userRole: null,
        batteryStatus: null,
        batteryState: null,
        edipMapModule: false,//编辑地图模态框
        wifiInfos: '',//wifi数据
        showWifiSetting:false,//wifi设置
        addMap: false,//添加地图
        showUpdate: false,//更新
        showVolume: false,//音量调节
        showBranch: false,//显示分支
        nowMapName: 'MAP',//当前地图名称
        delMap:false,//地图删除模态框
        delMapName:'',//要删除的地图名称
        disabledMoveMap: false,//地图移动
        stationName:'',//站点名称
        stationEdit: false,//站点编辑模态框
        showMoreBtns:false,//更多按钮
        showDragModule: false,//拖拽
        base64MapData: "",//base64地图
    },
    mutations:{
        guideIndex(state, num){
            state.guideIndex = num;
        },

        guideEndModule(state, type){
            state.guideEndModule = type;
        },

        guideModule(state, type){
            state.guideModule = type;
        },

        mapList(state, list){
            state.mapList = list
        },

        wayPointMsg(state, message){
            state.wayPointMsg = message;
        },
        
        //站点列表list
        stationList(state, type = []){
            state.stationList = type
        },

        //显示/隐藏站点列表模态框
        switchWaypointList(state, type){
            state.waypointsModule = type
        },

        //显示/隐藏添加站点
        switchAddStation(state, type){
            state.showAddStation = type
        },

        //显示隐藏站点详情
        switchWaypointDetail(state, type){
            state.showWaypointDetail = type;
        },

        //显示透明遮罩
        switchWhiteMask(state,type){
            state.showWhiteMask = type
        },

        //显示黑色半透明遮罩
        switchBlackMask(state,type){
            state.showBlackMask = type
        },

        //添加站点，机器人坐标
        setRobotPosition(state,info){
            state.robotPosition = info;
        },

        //删除站点名称
        setStationName(state, name){
            state.stationName = name
        },

        //轨迹列表
        trajectoryList(state, type = []){
            state.trajectoryList = type;
        },

        //显示/隐藏添加轨迹
        switchTrackList(state,type){
            state.trajectoryModule = type;
        },

        //显示/隐藏轨迹详情模态框
        switchTrackModule(state,type){
            state.showTrajectory = type;
        },

        //删除轨迹的名称
        delTrackName(state, name){
            state.delTrackName = name;
        },

        //轨迹删除模态框
        switchDeleteTrack(state,type){
            state.deleteTrack = type;
        },

        //显示/隐藏添加轨迹
        switchAddTrack(state,type){
            state.showAddTrack = type;
        },

        //缩放比例
        setScale(state, num){
            state.scale = num;
        },

        //设置缩放disabled按钮
        zoomDisabled(state, type){
            state.zoomDisabled = type
        },

        //设置ros状态
        setRosMode(state, type){
            state.rosMode = type;
        },

        //设置导航状态
        setNavControlStatus(state, type){
            state.navControlStatus = type;
        },
        
        mappingFlag(state, type){
            state.mappingFlag = type
        },

        //充电状态
        chargeStatus(state, type){
            state.chargeStatus = type;
        },

        showBattery(state, type){
            state.showBattery = type
        },

        //切换电池状态
        switchBatteryStatus(state,type){
            state.batteryStatus = type;
        },

        //编辑地图按钮组模态框
        switchEditMapBtns(state,type){
            state.edipMapModule = type;
        },

        //显示/隐藏设置权限
        switchAutherModule(state,type){
            state.authorization = type;
        },

        //用户角色
        userRole(state, user){
            state.userRole = user;
        },


        //电量
        subButtery(state,type){
            state.battery = type
        },

        //电量状态
        batteryState(state, text){
            state.batteryState = text;
        },

        //设置wifi
        setWifiInfos(state,infos){
            state.wifiInfos = infos
        },

        //切换wifi设置
        switchWifiSetting(state,type){
            state.showWifiSetting = type
        },

        //切换分支显示
        switchBranch(state, type){
            state.showBranch = type;
        },

        //显示/隐藏添加地图
        switchAddMap(state,type){
            state.addMap = type
        },

        //显示/隐藏更新
        switchUpdate(state, type){
            state.showUpdate = type
        },

        //切换音量调节
        switchvolume(state,type){
            state.showVolume = type
        },

        //当前地图名称
        setNowMapName(state,type){
            state.nowMapName = type;
        },

        //地图删除模态框
        switchDelMap(state,type){
            state.delMap = type;
        },

        //上传地图模态框
        switchUploadMap(state,type){
            state.uploadMap = type;
        },

        //下载地图
        switchDownloadMap(state,type){
            state.downloadMap = type;
        },

        //要删除的地图名称
        setDelMapName(state,info){
            state.delMapName = info;
        },

        //禁止和开启移动地图
        switchMoveMap(state,type){
            state.disabledMoveMap = type;
        },

        //站点编辑
        switchStationEdit(state,type){
            state.stationEdit = type
        },
        
        //设置轨迹详情
        setTrackDetail(state,info){
            state.trackDetail = info
        },

        //切换更多按钮
        switchMoreBtns(state,type = false){
            state.showMoreBtns = type
        },

        //切换拖拽模态框
        switchDragModule(state,type = false){
            state.showDragModule = type
        },

        //放大缩小比例
        mapScale(state,type){
            state.scale = type
        },

        //base64地图数据
        base64MapData(state, data){
            state.base64MapData = data
        }
       
    }
})